<?php
function smarty_function_group_select($params, &$smarty)
{
	$select = SilkForm::create_input_select(array("name" => "groups[]", "multiple" => true, "size" => 5));
	
	$items = array();
	foreach( $params["groups"] as $group ) {
		if( $group->name != "" ) {
			$items[$group->id] = $group->name;
		}
	}
	
	$selected = array();
	foreach( $params["userGroups"] as $userGroup ) {
		$selected[$userGroup->id] = $userGroup->id;
	}
	
	$select .= SilkForm::create_input_options(array("items" => $items, "selected_values" => $selected));
	$select .= SilkForm::create_end_tag("select");
	return $select;
}

# vim:ts=4 sw=4 noet
?>